package com.mjh.zhujianju.enums;

/**
 * @author liuyang
 * @Description:
 * @date 2018/8/14 23:32
 */
public enum  PermissionEnum {

    BANERS_SITE_INDEX("1","首页"),
    BANERS_SITE_PARTY("2","党建"),
    BANERS_SITE_VISIT("3","信访");

    private String code;
    private String name;

    PermissionEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static PermissionEnum[] getEnums(){
        return PermissionEnum.values();
    }

    public static String getName(String code){
        if(code == null){
            return null;
        }

        for (PermissionEnum permissionEnum : PermissionEnum.values()){
            if(code.equals(permissionEnum.getCode())){
                return permissionEnum.getName();
            }
        }

        return null;
    }
}
